package com.lyw.GeoLocationClient.utils;

import com.lyw.GeoLocationClient.R;

public class IconManager {
    private int iconIndex;
    private int colorIndex;

    public static IconManager instance;

    public static IconManager getInstance() {
        if (instance == null) {
            instance = new IconManager();
        }
        return instance;
    }

    public IconManager() {
        reset();
        instance = this;
    }

    public void reset() {
        iconIndex = 0;
        colorIndex = 0;
    }

    private static int[] COLORS = {
            R.color.darkcyan,
            R.color.darkorange,
            R.color.sienna,
            R.color.darkgreen,
            R.color.mediumaquamarine,
            R.color.cornflowerblue,
            R.color.gray,
            R.color.mediumslateblue,
            R.color.limegreen,
            R.color.midnightblue,
            R.color.darkgreen,
    };


    private static int[] ICONS = {
        R.drawable.icon_marka,
        R.drawable.icon_markb,
        R.drawable.icon_markc,
        R.drawable.icon_markd,
        R.drawable.icon_marke,
        R.drawable.icon_markf,
        R.drawable.icon_markg,
        R.drawable.icon_markh,
        R.drawable.icon_marki,
        R.drawable.icon_markj,
    };

    public int getIcon() {
        if (iconIndex >= ICONS.length -1) iconIndex = 0;
        return ICONS[iconIndex++];
    }

    public int getColor() {
        if (colorIndex >= COLORS.length -1 ) colorIndex = 0;
        return COLORS[colorIndex++];
    }

    public int getIcon(int index) {
        if (index < 0 || index >= ICONS.length) {
            index = 0;
        }
        return ICONS[index];
    }

    public int getColor(int index) {
        if (index < 0 || index >= COLORS.length) {
            index = 0;
        }
        return COLORS[index];
    }
}
